/**
 * @param {ListNode} head
 * @return {ListNode}
 */
 var detectCycle = function(head) {
    let slow = fast = head
    while(fast && fast.next){
      slow = slow.next
      fast = fast.next.n
      if(slow == fast){
        return slow
      }
    }
    return null
};